function setCookie(key, val, {path, expires}={}){
    let p = "";
    if(path){
        p = ";path="+path;
    }
    let e = "";
    if(expires){
        const d = new Date();
        d.setDate(d.getDate()+expires);
        e = ";expires=" + d;
    }
    document.cookie = `${key}=${val}${p}${e}`;
}
function getCookie(key){
    const arr = document.cookie.split("; ")
    for(let i=0;i<arr.length;i++){
        if(arr[i].split("=")[0] === key){
            return arr[i].split("=")[1];
        }
    }
    return "";
}
function removeCookie(key, ops={}){
    ops.expires = -1;
    setCookie(key, "", ops);
}
